<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>个人信息绑定</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<!--<link href="../css/mui.min.css" rel="stylesheet" />-->
		<link rel="stylesheet" type="text/css" href="css/base2.css" />
		<link rel="stylesheet" type="text/css" href="css/Monitor.css" />
	</head>

	<body>

		<!--<div class="Division1" style="margin-bottom: 5px;">
		</div>-->
		<!--<div class="name_box">
			设备编号：<input type="text" name="vehCode" id="vehCode" value="" placeholder="输入设备编号" />
		</div>
		<hr class="hr1" />
		<div class="name_box">
			设备类型：<input type="text" name="productId" id="productId" value="" />
		</div>-->
		<hr class="hr1" />
		<div class="Division1" style="margin-top: -10px;">
		</div>
		<li id="showImgUrl" style="display: none;">
			<img src="" width="65px" height="65px" id="imgUrl" /></li>
		<div class="photo_border" id="btnImgUrl">
			+
		</div>
		<p class="Notes">请上传您的头像！</p>
		<div class="Division1"></div>
		<!--<div class="set" align="center" id="btnAdd">上 传</div>-->
		<input class="set" id="btnAdd" readonly="true" align="center" value="上 传" />
		<script src="js/mui.min.js"></script>
		<script src="js/wf.js"></script>
		<script src="js/zepto.min.js"></script>
		<script src="js/tools/picFactory.js"></script>
		<script type="text/javascript">
			var f1 = new Array();
			var picFactory = new picFactory();
			$(function() {
				mui.init();
				mui.plusReady(function() {
					var self = plus.webview.currentWebview();
					var username = self.username;
					var value = self.value;

					self.setBounce({});
					setPhoto();

					$("#btnAdd").on("tap", function() {

						var datas = new Object();

						datas.FileArr = f1.toString();
						datas.username = username;
						plus.nativeUI.showWaiting();
						wf.ajax("Account/UserPicAdd", {
							traditional: true,
							type: "post",
							data: datas,
							dataType: "json",
							success: function(resule) {
								if(resule.Code == "20000") {
									mui.toast(resule.Msg);
									plus.nativeUI.closeWaiting();
									refreshParent();
								} else {
									mui.toast(resule.Msg);
									plus.nativeUI.closeWaiting();
								}

							}
						});

					});

				});

			
				function setPhoto() {
					$("#btnImgUrl").on("tap", function() {
						picFactory.getPhoto(function(url) {
							
							$("#showImgUrl").show();
							$("#btnImgUrl").hide();
							$(".Notes").hide();
							f1.push(url);
							$("#imgUrl").attr("src", url);
						});
					});
				}

			});
			
			function refreshParent() {
			var main = plus.webview.getWebviewById('user'); //或者通过A页面id获取A页面对象
			main.reload(true);
			mui.fire(main, "pageflowrefresh");
			mui.back();
		}
		</script>
	</body>

</html>